# for windows bat

echo PLEASE run this in javascript directory

set HOME=c:\us%ers\hui
set TARGET=%HOME%\workspace\apache-tomcat-10.1.35\webapps

echo TARGET = %TARGET%
set HTML_ROOT=%TARGET%\ROOT
set CLASS_ROOT=%TARGET%

echo HTML=%HTML_ROOT%
echo CLASS=%CLASS_ROOT%

copy *.html %HTML_ROOT%
copy *.js %HTML_ROOT%
copy *.mp3 %HTML_ROOT%

xcopy app %CLASS_ROOT%\app /s
pause
exit 

# TODO use .war file ?


SSH_HOST=peter@127.0.0.1
TARGET=$HOME/Documents/workspace/apache-tomcat-10.1.34/webapps
# APP_BASE=examples
APP_BASE=app


HTML_ROOT=$SSH_HOST:$TARGET/ROOT
CLASS_ROOT=$SSH_HOST:$TARGET
echo HTML_ROOT=$HTML_ROOT
echo CLASS_ROOT=$CLASS_ROOT

if [ "help" == "$1" ];
then
    echo it deploy everything to local server:
    echo FOLDER: $HTML_ROOT
    echo FILES: \*.html,  \*.js, \*.mp3 
    echo FOLDER: $CLASS_ROOT
    echo SUBFOLDER: WEB-INF/\* 
    exit 0
fi


if [ "clean" == "$1" ];
then
    echo CLEANing $TARGET/$APP_BASE
    ssh peter@127.0.0.1 "rm -rf $TARGET/$APP_BASE"
    exit 0
fi


# copy the html, js, mp3 files
scp *.html *.js *.mp3 $HTML_ROOT

# copy the java class, websocket and tcp server
scp -r app $CLASS_ROOT



